package cn.edu.nju.software.rmi;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

public class RegisterWithRMIServer {
	public static void main(String args[]) {
		try {
			
			//Create the object of server
			DetailSystemInterface obj = new DetailSystemInterfaceImpl();
			//启动RMI注册服务，指定端口为3217（3217为默认端口）
			LocateRegistry.createRegistry(1099);
			//把DetailSystem注册到另一台启动了RMI注册服务的机器上，命名为DetailSystem
			System.setProperty("java.rmi.server.hostname", "172.25.73.33");
			Naming.rebind("rmi:/172.25.73.28:1099/DetailSystem", obj);
			System.out.println("Detail System Server start!");
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		}
		//SellerServer server = new SellerServer();
		//server.init("AgentToSeller_JAVA");
		//server.run();
		
	}
}
